<template>
  <div id="app">
    <input type="number" @input="edit" :value="count">
    <span>{{count}}</span>
    <button @click="increament">+</button>
  </div>
</template>

<script>

  export default {
    computed: {
      count () {
        return this.$store.state.count
      }
    },
    methods: {
      increament () {
        this.$store.dispatch('addCount')
        this.$axios.get('http://127.0.0.1:8080/access_token')
          .then(function (response) {
            console.log(response)
          })
          .catch(function (error) {
            console.log(error)
          })
      },
      edit (e) {
        this.$store.dispatch('editCount', e.target.value)
      }
    }
  }
</script>
